home *** CD-ROM | disk | FTP | other *** search
/ Take-Home Tutor en Espanol / TakeHomeTutor.iso / pc / En espanol / Take-Home Tutor 3 / template3.swf / scripts / frame_1 / DoAction_2.as next >
Encoding:
Text File  |  2003-09-23  |  1.8 KB  |  76 lines

  1. function initDiacriticalHandlers()
  2. {
  3.    var bx;
  4.    var i = 0;
  5.    while(i < gAnswerBoxes.length)
  6.    {
  7.       bx = gAnswerBoxes[i];
  8.       bx.onSetFocus = function(oldfocus)
  9.       {
  10.          trace("Set: What\'s this oldfocus? : " + oldfocus);
  11.          trace("Set: What\'s this this? : " + this);
  12.          PMSI.lastTextField = this;
  13.       };
  14.       bx.onKillFocus = function(newfocus)
  15.       {
  16.          trace("Set: What\'s this newfocus? : " + newfocus);
  17.          trace("Set: What\'s this this? : " + this);
  18.          PMSI.lastTextField = newfocus;
  19.       };
  20.       bx.onKillFocus = function()
  21.       {
  22.       };
  23.       bx.onChanged = function()
  24.       {
  25.          PMSI.textFuncs.setReplacePos();
  26.       };
  27.       bx.tabEnabled = true;
  28.       i++;
  29.    }
  30.    TextField.prototype.cSetFocus = function()
  31.    {
  32.       Selection.setFocus(this);
  33.    };
  34.    this.onEnterFrame = focusSetter;
  35. }
  36. function focusSetter()
  37. {
  38.    if(Selection.getFocus() == null)
  39.    {
  40.       defaultBox.cSetFocus();
  41.    }
  42.    else
  43.    {
  44.       trace("Default focus set");
  45.       delete this.onEnterFrame;
  46.    }
  47. }
  48. if(_global.PMSI == null)
  49. {
  50.    _global.PMSI = {};
  51.    PMSI.VENDOR_NAME = "Purple Monkey Studios, Inc.";
  52.    PMSI.DefList = {};
  53. }
  54. PMSI.textFuncs = {};
  55. PMSI.lastTextField = null;
  56. PMSI.textFuncs.setReplacePos = function()
  57. {
  58.    var ltf = PMSI.lastTextField;
  59.    ltf._lastCaretIndex = Selection.getCaretIndex();
  60.    ltf._startSel = Selection.getBeginIndex();
  61.    ltf._endSel = Selection.getEndIndex();
  62.    if(__DEBUG)
  63.    {
  64.       trace("Last caret index: " + ltf._lastCaretIndex);
  65.       trace("Start selection:  " + ltf._startSel);
  66.       trace("End selection:    " + ltf._endSel);
  67.    }
  68. };
  69. PMSI.textFuncs.replaceSel = function(s)
  70. {
  71.    var ltf = PMSI.lastTextField;
  72.    Selection.setFocus(ltf);
  73.    Selection.setSelection(ltf._startSel,ltf._endSel);
  74.    ltf.replaceSel(s);
  75. };
  76.